using System;

namespace Caramel
{
	public static class TypeExtensions
	{
		public static bool IsNullable(this Type type)
		{
			if (!type.IsValueType)
			{
				return true;
			}

			return
				type.IsGenericType &&
				!type.IsGenericTypeDefinition &&
				(type.GetGenericTypeDefinition() == typeof(Nullable<>));
		}
	}
}
